#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int ret;
    int memo[2500];
    int lengthOfLIS(vector<int>& nums) {
        int n = nums.size();
        for (int i = 0; i < n; i++)
        {
            ret = max(ret, dfs(nums, i));
        }
        return ret;
    }
    int dfs(vector<int>& nums, int n) {
        if (memo[n]) return memo[n];
        int flag = 0;
        int ret = 0;
        for (int i = 0; i < n; i++) {
            if (nums[i] < nums[n]) {
                flag = 1;
                ret = max(ret, dfs(nums, i));
            }
        }
        memo[n] = flag == 1 ? ret + 1 : 1;
        return flag == 1 ? ret + 1 : 1;
    }
};